home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / OWLINC.PAK / COMMCTRL.H < prev    next >
C/C++ Source or Header  |  1997-05-06  |  32KB  |  979 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // Copyright (c) 1995, 1997 by Borland International, All Rights Reserved
  4. //
  5. //$Revision:   10.26  $
  6. //
  7. // Definition of classes for CommonControl encapsulation
  8. //----------------------------------------------------------------------------
  9. #if !defined(OWL_COMMCTRL_H)
  10. #define OWL_COMMCTRL_H
  11.  
  12. #if !defined(OWL_CONTROL_H)
  13. # include <owl/control.h>
  14. #endif
  15. #if !defined(OWL_MODULE_H)
  16. # include <owl/module.h>
  17. #endif
  18. #if !defined(__RICHEDIT_H) && defined(BI_PLAT_WIN32)
  19. # include <richedit.h>
  20. #endif
  21.  
  22. #if defined(BI_NAMESPACE)
  23. namespace OWL {
  24. #endif
  25.  
  26. //
  27. // Property sheets notify property pages of events via the standard WM_NOTIFY/
  28. // NMHDR* mechanism. However, there is no Control ID involved in this
  29. // particular flavour of notification. The WM_NOTIFY handler of ObjectWindows
  30. // relies on the CtlID for subdispatching. Hence, we'll have 'PropPageID' as
  31. // the default identifier so that we do not have to repeat dispatching logic
  32. // in the 'EvNotify' of TPropertyPage.
  33. //
  34. const int PropPageID = 0xFFF0;
  35.  
  36. //----------------------------------------------------------------------------
  37.  
  38.  
  39. //
  40. // Get the necessary system headers
  41. //
  42. #if !defined(_INC_COMMCTRL)
  43. # include <commctrl.h>
  44. #endif
  45.  
  46. // Generic definitions/compiler options (eg. alignment) preceeding the
  47. // definition of classes
  48. #include <services/preclass.h>
  49.  
  50. //
  51. // Define some missing commctrl structs
  52. //
  53. #if !defined(BI_PLAT_WIN32)
  54.   typedef struct _IMAGEINFO {
  55.     HBITMAP hbmImage;
  56.     HBITMAP hbmMask;
  57.     int     Unused1;
  58.     int     Unused2;
  59.     RECT    rcImage;
  60.   } IMAGEINFO;
  61. #endif
  62.  
  63. //----------------------------------------------------------------------------
  64. // Forward declaration of classes used in dispatch macros
  65. //
  66. class _OWLCLASS THdrItem;
  67.  
  68.  
  69. //
  70. // class TCommCtrlDll
  71. // ~~~~~ ~~~~~~~~~~~~
  72. // Actual TModule derivative that wraps the common control DLL
  73. //
  74. class _OWLCLASS TCommCtrlDll : public TModule {
  75.   public:
  76.     TCommCtrlDll();
  77.  
  78.     TModuleProcV0 InitCommonControls;
  79.  
  80. #if defined(BI_PLAT_WIN32)
  81.     TModuleProc3<int,HIMAGELIST,HBITMAP,COLORREF> ImageList_AddMasked;
  82.     TModuleProc4<BOOL,HIMAGELIST,int,int,int>ImageList_BeginDrag;
  83.  
  84.     TModuleProcV0 ImageList_EndDrag;
  85.     TModuleProc3<BOOL,HWND,int,int> ImageList_DragEnter;
  86.     TModuleProc1<BOOL,HWND> ImageList_DragLeave;
  87.     TModuleProc2<BOOL,int,int> ImageList_DragMove;
  88.     TModuleProc4<BOOL,HIMAGELIST,int,int,int> ImageList_SetDragCursorImage;
  89.  
  90.     TModuleProc1<BOOL,BOOL> ImageList_DragShowNolock;
  91.     TModuleProc2<HIMAGELIST,POINT FAR*,POINT FAR*> ImageList_GetDragImage;
  92.  
  93.     TModuleProc10<BOOL,HIMAGELIST,int,HDC,int,int,int,int,COLORREF,COLORREF,UINT> ImageList_DrawEx;
  94.     TModuleProc3<BOOL,HIMAGELIST,int FAR*,int FAR*> ImageList_GetIconSize;
  95.     TModuleProc3<HICON,HIMAGELIST,int,UINT> ImageList_GetIcon;
  96.     TModuleProc3<BOOL,HIMAGELIST,int,IMAGEINFO FAR*> ImageList_GetImageInfo;
  97.     TModuleProc4<BOOL,HIMAGELIST,int,HBITMAP,HBITMAP> ImageList_Replace;
  98.     TModuleProc2<BOOL,HIMAGELIST,int> ImageList_Remove;
  99.     TModuleProc7<HIMAGELIST,HINSTANCE,LPCSTR,int,int,COLORREF,UINT,UINT> ImageList_LoadImage;
  100.     TModuleProc6<HIMAGELIST,HIMAGELIST,int,HIMAGELIST,int,int,int> ImageList_Merge;
  101.     TModuleProc3<BOOL,HIMAGELIST,int,int> ImageList_SetIconSize;
  102. #endif
  103.  
  104.     TModuleProc5<HBITMAP,HINSTANCE,int,UINT,LPCOLORMAP,int> CreateMappedBitmap;
  105.     TModuleProc1<HPROPSHEETPAGE,LPCPROPSHEETPAGE> CreatePropertySheetPage;
  106.     TModuleProc4<HWND,LONG,LPCSTR,HWND,UINT> CreateStatusWindow;
  107.     TModuleProc13<HWND,HWND,DWORD,UINT,int,HINSTANCE,UINT,LPCTBBUTTON,int,int,
  108.                    int,int,int,UINT> CreateToolbarEx;
  109.     TModuleProc12<HWND,DWORD,int,int,int,int,HWND,int,HINSTANCE,HWND,int,int,
  110.                    int> CreateUpDownControl;
  111.     TModuleProc1<BOOL,HPROPSHEETPAGE> DestroyPropertySheetPage;
  112.     TModuleProcV3<HWND,HWND,int> DrawInsert;
  113.     TModuleProcV4<HDC,LPRECT,LPCSTR,UINT> DrawStatusText;
  114.     TModuleProcV3<HWND,LPRECT,LPINT> GetEffectiveClientRect;
  115.  
  116.     TModuleProc5<HIMAGELIST,int,int,UINT,int,int> ImageList_Create;
  117.     TModuleProc1<BOOL,HIMAGELIST> ImageList_Destroy;
  118.     TModuleProc1<int,HIMAGELIST> ImageList_GetImageCount;
  119.     TModuleProc3<int,HIMAGELIST,HBITMAP,HBITMAP> ImageList_Add;
  120.     TModuleProc3<int,HIMAGELIST,int,HICON> ImageList_ReplaceIcon;
  121.     TModuleProc2<COLORREF,HIMAGELIST,COLORREF> ImageList_SetBkColor;
  122.     TModuleProc1<COLORREF,HIMAGELIST> ImageList_GetBkColor;
  123.     TModuleProc3<BOOL,HIMAGELIST,int,int> ImageList_SetOverlayImage;
  124.     TModuleProc6<BOOL,HIMAGELIST,int,HDC,int,int,UINT> ImageList_Draw;
  125.  
  126.     TModuleProc3<int,HWND,POINT,BOOL> LBItemFromPt;
  127.     TModuleProc1<BOOL,HWND> MakeDragList;
  128.     TModuleProcV7<UINT,TParam1,TParam2,HMENU,HINSTANCE,HWND,UINT FAR*> MenuHelp;
  129.     TModuleProc1<int,LPCPROPSHEETHEADER> PropertySheet;
  130.     TModuleProc3<BOOL,HWND,UINT,LPINT> ShowHideMenuCtl;
  131. };
  132.  
  133.  
  134.  
  135. //
  136. // Simple wrapper class which creates a single instance of the TCommCtrlDll
  137. // class defined above.
  138. //
  139. class _OWLCLASS TCommCtrl {
  140.   public:
  141.     static TCommCtrlDll* Dll();
  142.     static bool          IsAvailable();
  143. };
  144.  
  145.  
  146. //
  147. // class TXCommCtrl
  148. // ~~~~~ ~~~~~~~~~~
  149. // Exception object thrown by the Common Control wrappers of ObjectWindows.
  150. //
  151. class _OWLCLASS_RTL TXCommCtrl : public TXOwl {
  152.   public:
  153.     TXCommCtrl();
  154. #if defined(BI_NO_COVAR_RET)
  155.     TXBase*     Clone();
  156. #else
  157.     TXCommCtrl* Clone();
  158. #endif
  159.     void        Throw();
  160.     static void Raise();
  161. };
  162.  
  163. //
  164. // class TNotify
  165. // ~~~~~ ~~~~~~~
  166. // TNotify is a thin wrapper around the NMHDR structure. It's a
  167. // place-holder for future enhancements for handling notifications.
  168. //
  169. class _OWLCLASS TNotify : public NMHDR {
  170.   public:
  171.     TNotify();
  172.     TNotify(HWND ctl, uint id, uint code);
  173. };
  174.  
  175.  
  176. //----------------------------------------------------------------------------
  177. // Structures used for UpDown (Spin Ctrl) notifications
  178. //----------------------------------------------------------------------------
  179. //
  180. // class TNmUpDown
  181. // ~~~~~ ~~~~~~~~~
  182. // TNmUpDown is a wrapper of the NM_UPDOWN structure sent with
  183. // notifications from an 'UpDown' control.
  184. //
  185. class _OWLCLASS TNmUpDown : public NM_UPDOWN {
  186.   public:
  187.     TNmUpDown(HWND hwnd, uint id, uint code, int pos, int delta);  
  188.  
  189.     // Allows the notification structure to be transparently treated an
  190.     // an NMHDR structure thereby eliminating the need to explicitly refer
  191.     // to the NMHDR data member [always the first member of notification
  192.     // structures]
  193.     //
  194.     operator  NMHDR&() { return hdr; }
  195. };
  196.  
  197.  
  198.  
  199. //----------------------------------------------------------------------------
  200. // Structures used for Tab Control notifications
  201. //----------------------------------------------------------------------------
  202. //
  203. // class TTabKeyDown
  204. // ~~~~~ ~~~~~~~~~~~
  205. // Wrapper of the TC_KEYDOWN structure sent to the parent of a tabcontrol
  206. // to notify that a key has been pressed
  207. //
  208. class _OWLCLASS TTabKeyDown : public TC_KEYDOWN {
  209.   public:
  210.     TTabKeyDown();
  211.     TTabKeyDown(HWND ctl, uint id, uint code, uint16 vk, uint flg);
  212.  
  213.     operator  NMHDR&() { return hdr; }
  214. };
  215.  
  216.  
  217.  
  218. //----------------------------------------------------------------------------
  219. // Structures used for tooltip notifications & API
  220. //----------------------------------------------------------------------------
  221. //
  222. // class TTooltipText
  223. // ~~~~~ ~~~~~~~~~~~~
  224. // TTooltipText identifies a tool for which text is to be displayed. It
  225. // is sent to the parent of the tooltip via a WM_NOTIFY/TTN_NEEDTEXT
  226. // notification. It receives the text to be displayed.
  227. //
  228. class _OWLCLASS TTooltipText : public TOOLTIPTEXT {
  229.   public:
  230.     operator  NMHDR&() { return hdr; }
  231.  
  232.     // Set the text to be displayed for the tool.
  233.     //
  234.     void        SetText(char far* buff);
  235.     void        SetText(int resId, HINSTANCE hInstance);
  236.     void        CopyText(const char far* buff);
  237. };
  238.  
  239.  
  240.  
  241. //----------------------------------------------------------------------------
  242. // Structures used for Column Header notifications
  243. //----------------------------------------------------------------------------
  244. //
  245. // class THdrNotify
  246. // ~~~~~ ~~~~~~~~~~
  247. // THdrNotify encapsulates the 'HD_NOTIFY' structure which is sent
  248. // with the WM_NOTIFY messages sent by the HeaderControl to its parent.
  249. //
  250. class _OWLCLASS THdrNotify : public HD_NOTIFY {
  251.   public:
  252.     operator  NMHDR&() { return hdr; }
  253. };
  254.  
  255.  
  256.  
  257. //----------------------------------------------------------------------------
  258. // Structures used for RichEdit notifications and API
  259. //----------------------------------------------------------------------------
  260. #if defined(BI_PLAT_WIN32)
  261. //
  262. // class TEnDropFiles
  263. // ~~~~~ ~~~~~~~~~~~~
  264. // Structure sent with EN_DROPFILES notification.
  265. //
  266. class _OWLCLASS TEnDropFiles : public ENDROPFILES {
  267.   public:
  268.     operator  NMHDR&() { return nmhdr; }
  269. };
  270.  
  271. //
  272. // class TMsgFilter
  273. // ~~~~~ ~~~~~~~~~~
  274. // Structure sent with EN_MSGFILTER notification
  275. //
  276. class _OWLCLASS TMsgFilter : public MSGFILTER {
  277.   public:
  278.     operator  NMHDR&() { return nmhdr; }
  279. };
  280.  
  281. //
  282. // class TEnProtected
  283. // ~~~~~ ~~~~~~~~~~~~
  284. // Structure sent with EN_PROTECTED notification
  285. //
  286. class _OWLCLASS TEnProtected : public ENPROTECTED {
  287.   public:
  288.     operator  NMHDR&() { return nmhdr; }
  289. };
  290.  
  291. //
  292. // class TReqResize
  293. // ~~~~~ ~~~~~~~~~~
  294. // Structure sent with EN_REQUESTRESIZE notification
  295. //
  296. class _OWLCLASS TReqResize : public REQRESIZE {
  297.   public:
  298.     operator  NMHDR&() { return nmhdr; }
  299. };
  300.  
  301. //
  302. // class TSelChange
  303. // ~~~~~ ~~~~~~~~~~
  304. // Structure sent with EN_SELCHANGE notification
  305. //
  306. class _OWLCLASS TSelChange : public SELCHANGE {
  307.   public:
  308.     operator  NMHDR&() { return nmhdr; }
  309. };
  310.  
  311. #endif  //  BI_PLAT_WIN32
  312.  
  313. //
  314. // Forward declarations of notifications
  315. //
  316.  
  317. #include <pshpack1.h>
  318.  
  319. //----------------------------------------------------------------------------
  320. // Structures used for ListView control (TListWindow) notifications
  321. //----------------------------------------------------------------------------
  322. //
  323. // class TLwNotify
  324. // ~~~~~ ~~~~~~~~~
  325. // Basic TListWindow notification
  326. //
  327. class _OWLCLASS TLwNotify : public _NM_LISTVIEW {
  328.   public:
  329.     operator  NMHDR&() { return hdr; }
  330. };
  331.  
  332. //
  333. // class TLwDispInfoNotify
  334. // ~~~~~ ~~~~~~~~~~~~~~~~~
  335. // A TListWindow notification to repaint an item.
  336. //
  337. class _OWLCLASS TLwDispInfoNotify : public _LV_DISPINFO {
  338.   public:
  339.     operator  NMHDR&() { return hdr; }
  340. };
  341.  
  342. //
  343. // class TLwKeyDownNotify
  344. // ~~~~~ ~~~~~~~~~~~~~~~~
  345. // A TListWindow notification that a key has been pressed.
  346. //
  347. class _OWLCLASS TLwKeyDownNotify : public _LV_KEYDOWN {
  348.   public:
  349.     operator  NMHDR&() { return hdr; }
  350. };
  351.  
  352.  
  353.  
  354. //----------------------------------------------------------------------------
  355. // Structures used for TreeView control (TTreeWindow) notifications
  356. //----------------------------------------------------------------------------
  357. //
  358. // class TTwNotify
  359. // ~~~~~ ~~~~~~~~~
  360. // Basic TTreeWindow notification
  361. //
  362. class _OWLCLASS TTwNotify : public NM_TREEVIEW {
  363.   public:
  364.     operator  NMHDR&() { return hdr; }
  365. };
  366.  
  367. //
  368. // class TTwDispInfoNotify
  369. // ~~~~~ ~~~~~~~~~~~~~~~~~
  370. // A TTreeWindow notification to repaint an item.
  371. //
  372. class _OWLCLASS TTwDispInfoNotify : public TV_DISPINFO {
  373.   public:
  374.     operator  NMHDR&() { return hdr; }
  375. };
  376.  
  377. //
  378. // class TTwKeyDownNotify
  379. // ~~~~~ ~~~~~~~~~~~~~~~~
  380. // A TTreeWindow notification that a key has been pressed.
  381. //
  382. class _OWLCLASS TTwKeyDownNotify : public TV_KEYDOWN {
  383.   public:
  384.     operator  NMHDR&() { return hdr; }
  385. };
  386.  
  387. //
  388. // class TTwHitTestInfo
  389. // ~~~~~ ~~~~~~~~~~~~~~
  390. // A TTreeWindow notification for hit-testing.
  391. //
  392. class _OWLCLASS TTwHitTestInfo : public TV_HITTESTINFO {
  393.   public:
  394. };
  395.  
  396.  
  397. // Generic definitions/compiler options (eg. alignment) following the
  398. // definition of classes
  399. #include <services/posclass.h>
  400.  
  401. //----------------------------------------------------------------------------
  402. // DISPATCH.H
  403. //
  404. int32 _OWLFUNC
  405. v_NMHDRCode_Dispatch(GENERIC& generic,
  406.                      void    (GENERIC::*pmf)(uint),
  407.                      uint     wParam,
  408.                      int32    lParam);
  409.  
  410. //----------------------------------------------------------------------------
  411. // SIGNATURE.H
  412. //
  413. template <class T>
  414. inline void _CALLCNVN (T::*v_NMHDR_Sig(void _CALLCNVN (T::*pmf)(NMHDR far&)))(NMHDR far&)
  415. {
  416.   return pmf;
  417. }
  418.  
  419. template <class T>
  420. inline bool _CALLCNVN (T::*b_NMHDR_Sig(bool _CALLCNVN (T::*pmf)(NMHDR far&)))(NMHDR far&)
  421. {
  422.   return pmf;
  423. }
  424.  
  425. template <class T>
  426. inline void _CALLCNVN (T::*v_NOTIFY_Sig(void _CALLCNVN (T::*pmf)(TNotify far&)))(TNotify far&)
  427. {
  428.   return pmf;
  429. }
  430.  
  431. template <class T>
  432. inline bool _CALLCNVN (T::*b_NOTIFY_Sig(bool _CALLCNVN (T::*pmf)(TNotify far&)))(TNotify far&)
  433. {
  434.   return pmf;
  435. }
  436.  
  437. template <class T>
  438. inline int _CALLCNVN (T::*i_NOTIFY_Sig(int _CALLCNVN (T::*pmf)(TNotify far&)))(TNotify far&)
  439. {
  440.   return pmf;
  441. }
  442.  
  443. //----------------------------------------------------------------------------
  444. // WINDOWEV.H
  445. //
  446.  
  447. //
  448. // Notification handled by parent with handler returning void
  449. //      i.e.  void method()
  450. //
  451. #define EV_COMMCTL_NOTIFY(id, notifyCode, method)\
  452.   {notifyCode, id, (TAnyDispatcher)::v_Dispatch,\
  453.   (TMyPMF)v_Sig(&TMyClass::method)}
  454.  
  455. //
  456. // Notification handled by parent with handler expecting notification
  457. // code.        i.e. void method(uint notifyCode)
  458. //
  459. #define EV_COMMCTL_NOTIFY_AND_CODE(id, notifyCode, method)\
  460.   {notifyCode, id, (TAnyDispatcher)::v_NMHDRCode_Dispatch,\
  461.   (TMyPMF)v_U_Sig(&TMyClass::method)}
  462.  
  463. //
  464. // Notification handled by parent with handler expecting NMHDR&
  465. // as parameter.        i.e. void method(NMHDR& nmHdr)
  466. //
  467. #define EV_COMMCTL_NOTIFY_AND_NMHDR(id, notifyCode, method)\
  468.   {notifyCode, id, (TAnyDispatcher)::v_LPARAM_Dispatch,\
  469.   (TMyPMF)v_NMHDR_Sig(&TMyClass::method)}
  470.  
  471. //
  472. // Notification handled by parent with handler expecting NMHDR& and
  473. // returning a bool.
  474. //                      i.e. bool method(NMHDR& nmHdr)
  475. //
  476. #define EV_COMMCTL_NOTIFY_BOOL_AND_NMHDR(id, notifyCode, method)\
  477.   {notifyCode, id, (TAnyDispatcher)::B_LPARAM_Dispatch,\
  478.   (TMyPMF)b_NMHDR_Sig(&TMyClass::method)}
  479.  
  480. //
  481. // Notification handled by parent with handler expecting TNotify&
  482. // as parameter.
  483. //                      i.e. void method(TNotify& nmHdr)
  484. //
  485. #define EV_COMMCTL_NOTIFY_AND_NOTIFY(id, notifyCode, method)\
  486.   {notifyCode, id, (TAnyDispatcher)::v_LPARAM_Dispatch,\
  487.   (TMyPMF)v_NOTIFY_Sig(&TMyClass::method)}
  488.  
  489. //
  490. // Notification handled by parent with handler expecting TNotify& and
  491. // returning a bool.
  492. //                      i.e. bool method(TNotify& nmHdr)
  493. //
  494. #define EV_COMMCTL_NOTIFY_BOOL_AND_NOTIFY(id, notifyCode, method)\
  495.   {notifyCode, id, (TAnyDispatcher)::B_LPARAM_Dispatch,\
  496.   (TMyPMF)b_NOTIFY_Sig(&TMyClass::method)}
  497.  
  498. //
  499. // Notification handled by parent with handler expecting TNotify& and
  500. // returning an int.
  501. //                      i.e. int method(TNotify& nmHdr)
  502. //
  503. #define EV_COMMCTL_NOTIFY_INT_AND_NOTIFY(id, notifyCode, method)\
  504.   {notifyCode, id, (TAnyDispatcher)::i_LPARAM_Dispatch,\
  505.   (TMyPMF)i_NOTIFY_Sig(&TMyClass::method)}
  506.  
  507. #define EV_NM_CLICK(id, method)       EV_COMMCTL_NOTIFY(id, NM_CLICK, method)
  508. #define EV_NM_DBLCLK(id, method)      EV_COMMCTL_NOTIFY(id, NM_DBLCLK, method)
  509. #define EV_NM_KILLFOCUS(id, method)   EV_COMMCTL_NOTIFY(id, NM_KILLFOCUS, method)
  510. #define EV_NM_OUTOFMEMORY(id, method) EV_COMMCTL_NOTIFY(id, NM_OUTOFMEMORY, method)
  511. #define EV_NM_RCLICK(id, method)      EV_COMMCTL_NOTIFY(id, NM_RCLICK, method)
  512. #define EV_NM_RDBLCLK(id, method)     EV_COMMCTL_NOTIFY(id, NM_RDBLCLK, method)
  513. #define EV_NM_RETURN(id, method)      EV_COMMCTL_NOTIFY(id, NM_RETURN, method)
  514. #define EV_NM_SETFOCUS(id, method)    EV_COMMCTL_NOTIFY(id, NM_SETFOCUS, method)
  515.  
  516. //----------------------------------------------------------------------------
  517. // Header control notifications
  518. //
  519. template <class T>
  520. inline void _CALLCNVN (T::*v_HEADERNOTIFY_Sig(void _CALLCNVN (T::*pmf)(THdrNotify far&)))(THdrNotify far&)
  521. {
  522.   return pmf;
  523. }
  524.  
  525. template <class T>
  526. inline bool _CALLCNVN (T::*b_HEADERNOTIFY_Sig(bool _CALLCNVN (T::*pmf)(THdrNotify far&)))(THdrNotify far&)
  527. {
  528.   return pmf;
  529. }
  530.  
  531. //
  532. // Notification handled by parent with handler expecting THdrNotify&
  533. // as parameter.        i.e. void method(THdrNotify& nmHdr)
  534. //
  535. #define EV_HEADERNOTIFY(id, notifyCode, method)\
  536.   {notifyCode, id, (TAnyDispatcher)::v_LPARAM_Dispatch,\
  537.   (TMyPMF)v_HEADERNOTIFY_Sig(&TMyClass::method)}
  538.  
  539. //
  540. // Notification handled by parent with handler expecting THdrNotify& and
  541. // returning a bool.
  542. //                      i.e. bool method(THdrNotify& nmHdr)
  543. //
  544. #define EV_HEADERNOTIFY_BOOL(id, notifyCode, method)\
  545.   {notifyCode, id, (TAnyDispatcher)::B_LPARAM_Dispatch,\
  546.   (TMyPMF)b_HEADERNOTIFY_Sig(&TMyClass::method)}
  547.  
  548. #define EV_HDN_BEGINTRACK(id, method)       EV_HEADERNOTIFY_BOOL(id, HDN_BEGINTRACK, method)
  549. #define EV_HDN_DIVIDERDBLCLICK(id, method)  EV_HEADERNOTIFY(id, HDN_DIVIDERDBLCLICK, method)
  550. #define EV_HDN_ENDTRACK(id, method)         EV_HEADERNOTIFY(id, HDN_ENDTRACK, method)
  551. #define EV_HDN_ITEMCHANGED(id,method)       EV_HEADERNOTIFY(id, HDN_ITEMCHANGED, method)
  552. #define EV_HDN_ITEMCHANGING(id,method)      EV_HEADERNOTIFY_BOOL(id, HDN_ITEMCHANGING, method)
  553. #define EV_HDN_ITEMCLICK(id, method)        EV_HEADERNOTIFY(id, HDN_ITEMCLICK, method)
  554. #define EV_HDN_TRACK(id, method)            EV_HEADERNOTIFY_BOOL(id, HDN_TRACK, method)
  555.  
  556. //----------------------------------------------------------------------------
  557. // TabControl notifications
  558. //
  559.  
  560. template <class T>
  561. inline void _CALLCNVN (T::*v_KEYDOWNNOTIFY_Sig(void _CALLCNVN (T::*pmf)(TTabKeyDown far&)))(TTabKeyDown far&)
  562. {
  563.   return pmf;
  564. }
  565.  
  566. //
  567. // Notification handled by parent with handler expecting THdrNotify&
  568. // as parameter.        i.e. void method(THdrNotify& nmHdr)
  569. //
  570. #define EV_TCN_KEYDOWN(id, method)\
  571.   {TCN_KEYDOWN, id, (TAnyDispatcher)::v_LPARAM_Dispatch,\
  572.   (TMyPMF)v_KEYDOWNNOTIFY_Sig(&TMyClass::method)}
  573.  
  574.  
  575. #define EV_TCN_SELCHANGE(id, method)    EV_COMMCTL_NOTIFY_AND_NOTIFY(id, TCN_SELCHANGE, method)
  576. #define EV_TCN_SELCHANGING(id, method)  EV_COMMCTL_NOTIFY_BOOL_AND_NOTIFY(id, TCN_SELCHANGING, method)
  577.  
  578. //----------------------------------------------------------------------------
  579. // Property Page Notifications
  580. // NOTE: These macros hard-code the CtlID to PropPageID. Since Property
  581. //       Pages do not have the concept of IDs [the way Ctls have an
  582. //       ID by which their parent can identify them] this mechanism
  583. //       facilitates NOTIFICATION dispatching.
  584. //
  585. #define EV_PSN_APPLY(method) \
  586.         EV_COMMCTL_NOTIFY_INT_AND_NOTIFY(PropPageID, PSN_APPLY, method)
  587.  
  588. /*
  589. #define EV_PSN_HASHELP(method) \
  590.         EV_COMMCTL_NOTIFY_BOOL_AND_NOTIFY(PropPageID, PSN_HASHELP, method)
  591. */
  592.  
  593. #define EV_PSN_HELP(method) \
  594.         EV_COMMCTL_NOTIFY_AND_NOTIFY(PropPageID, PSN_HELP, method)
  595.  
  596. #define EV_PSN_KILLACTIVE(method)\
  597.         EV_COMMCTL_NOTIFY_BOOL_AND_NOTIFY(PropPageID, PSN_KILLACTIVE, method)
  598.  
  599. #define EV_PSN_QUERYCANCEL(method)\
  600.         EV_COMMCTL_NOTIFY_BOOL_AND_NOTIFY(PropPageID, PSN_QUERYCANCEL, method)
  601.  
  602. #define EV_PSN_RESET(method)\
  603.         EV_COMMCTL_NOTIFY_AND_NOTIFY(PropPageID, PSN_RESET, method)
  604.  
  605. #define EV_PSN_SETACTIVE(method)\
  606.         EV_COMMCTL_NOTIFY_INT_AND_NOTIFY(PropPageID, PSN_SETACTIVE, method)
  607.  
  608. #define EV_PSN_WIZBACK(method)\
  609.         EV_COMMCTL_NOTIFY_INT_AND_NOTIFY(PropPageID, PSN_WIZBACK, method)
  610.  
  611. #define EV_PSN_WIZFINISH(method)\
  612.         EV_COMMCTL_NOTIFY_BOOL_AND_NOTIFY(PropPageID, PSN_WIZFINISH, method)
  613.  
  614. #define EV_PSN_WIZNEXT(method)\
  615.         EV_COMMCTL_NOTIFY_INT_AND_NOTIFY(PropPageID, PSN_WIZNEXT, method)
  616.  
  617.  
  618. //----------------------------------------------------------------------------
  619. // RichEdit Control notifications
  620. //
  621.  
  622. #if defined(BI_PLAT_WIN32)
  623.  
  624. template <class T>
  625. inline bool _CALLCNVN (T::*b_ENDROPFILES_Sig(bool _CALLCNVN (T::*pmf)(TEnDropFiles far&)))(TEnDropFiles far&)
  626. {
  627.   return pmf;
  628. }
  629.  
  630. template <class T>
  631. inline bool _CALLCNVN (T::*b_MSGFILTER_Sig(bool _CALLCNVN (T::*pmf)(TMsgFilter far&)))(TMsgFilter far&)
  632. {
  633.   return pmf;
  634. }
  635.  
  636. template <class T>
  637. inline bool _CALLCNVN (T::*b_PROTECTED_Sig(bool _CALLCNVN (T::*pmf)(TEnProtected far&)))(TEnProtected far&)
  638. {
  639.   return pmf;
  640. }
  641.  
  642. template <class T>
  643. inline void _CALLCNVN (T::*v_REQRESIZE_Sig(void _CALLCNVN (T::*pmf)(TReqResize far&)))(TReqResize far&)
  644. {
  645.   return pmf;
  646. }
  647.  
  648. template <class T>
  649. inline bool _CALLCNVN (T::*b_SELCHANGE_Sig(bool _CALLCNVN (T::*pmf)(TSelChange far&)))(TSelChange far&)
  650. {
  651.   return pmf;
  652. }
  653.  
  654. //
  655. // Notification handled by parent with handler expecting TEnDropFiles& and
  656. // returning a bool.
  657. //                      i.e. bool method(TEnDropFiles& nmHdr)
  658. //
  659. #define EV_EN_DROPFILES(id, method)\
  660.   {EN_DROPFILES, id, (TAnyDispatcher)::B_LPARAM_Dispatch,\
  661.   (TMyPMF)b_ENDROPFILES_Sig(&TMyClass::method)}
  662.  
  663. //
  664. // Notification handled by parent with handler expecting TMsgFilter& and
  665. // returning a bool.
  666. //                      i.e. bool method(TMsgFilter& nmHdr)
  667. //
  668. #define EV_EN_MSGFILTER(id, method)\
  669.   {EN_MSGFILTER, id, (TAnyDispatcher)::B_LPARAM_Dispatch,\
  670.   (TMyPMF)b_MSGFILTER_Sig(&TMyClass::method)}
  671.  
  672. //
  673. // Notification handled by parent with handler expecting TEnProtected& and
  674. // returning a bool.
  675. //                      i.e. bool method(TEnProtected& nmHdr)
  676. //
  677. #define EV_EN_PROTECTED(id, method)\
  678.   {EN_PROTECTED, id, (TAnyDispatcher)::B_LPARAM_Dispatch,\
  679.   (TMyPMF)b_PROTECTED_Sig(&TMyClass::method)}
  680.  
  681. //
  682. // Notification handled by parent with handler expecting TReqResize&.
  683. //
  684. //                      i.e. void method(TReqResize& nmHdr)
  685. //
  686. #define EV_EN_REQRESIZE(id, method)\
  687.   {EN_REQUESTRESIZE, id, (TAnyDispatcher)::v_LPARAM_Dispatch,\
  688.   (TMyPMF)v_REQRESIZE_Sig(&TMyClass::method)}
  689.  
  690. //
  691. // Notification handled by parent with handler expecting TSelChange& and
  692. // returning a bool.
  693. //                      i.e. bool method(TSelChange& nmHdr)
  694. //
  695. #define EV_RICHED_EN_SELCHANGE(id, method)\
  696.   {EN_SELCHANGE, id, (TAnyDispatcher)::B_LPARAM_Dispatch,\
  697.   (TMyPMF)b_SELCHANGE_Sig(&TMyClass::method)}
  698.  
  699. #endif  //  BI_PLAT_WIN32
  700.  
  701. //----------------------------------------------------------------------------
  702. // UpDown Control notifications
  703. //
  704. //
  705.  
  706. //
  707. //
  708. //
  709. inline
  710. TNmUpDown::TNmUpDown(HWND hwnd, uint id, uint code, int pos, int delta)
  711. {
  712.   iPos = pos;
  713.   iDelta = delta;
  714.   hdr.hwndFrom = hwnd;
  715.   hdr.idFrom = id;
  716.   hdr.code = code;
  717. }
  718.  
  719. template <class T>
  720. inline bool _CALLCNVN (T::*b_NMUPDOWN_NOTIFY_Sig(bool _CALLCNVN (T::*pmf)(TNmUpDown far&)))(TNmUpDown far&)
  721. {
  722.   return pmf;
  723. }
  724.  
  725. //
  726. // Notification handled by parent expecting a TNmUpDown notification
  727. //
  728. //      i.e. bool HandleUpDown(TNmUpDown& updownNot);
  729. //
  730. #define EV_UDN_DELTAPOS(id, method) \
  731.   {UDN_DELTAPOS, id, (TAnyDispatcher)::B_LPARAM_Dispatch,\
  732.   (TMyPMF)b_NMUPDOWN_NOTIFY_Sig(&TMyClass::method)}
  733.  
  734. //----------------------------------------------------------------------------
  735. // Tooltip notification
  736. //
  737.  
  738. template <class T>
  739. inline void _CALLCNVN (T::*v_NEEDTEXT_Sig(void _CALLCNVN (T::*pmf)(TTooltipText far&)))(TTooltipText far&)
  740. {
  741.   return pmf;
  742. }
  743.  
  744. #define EV_TTN_NEEDTEXT(id, method)  \
  745.   {TTN_NEEDTEXT, id, (TAnyDispatcher)::v_LPARAM_Dispatch,\
  746.   (TMyPMF)v_NEEDTEXT_Sig(&TMyClass::method)}
  747.  
  748.  
  749. //----------------------------------------------------------------------------
  750. // TreeWind control notifications
  751. //
  752. template <class T>
  753. inline void _CALLCNVN (T::*v_TREEWIND_NOTIFY_Sig(void _CALLCNVN (T::*pmf)(TTwNotify far&)))(TTwNotify far&)
  754. {
  755.   return pmf;
  756. }
  757.  
  758. template <class T>
  759. inline bool _CALLCNVN (T::*b_TREEWIND_NOTIFY_Sig(bool _CALLCNVN (T::*pmf)(TTwNotify far&)))(TTwNotify far&)
  760. {
  761.   return pmf;
  762. }
  763.  
  764. template <class T>
  765. inline void _CALLCNVN (T::*v_TV_KEYDOWN_NOTIFY_Sig(void _CALLCNVN (T::*pmf)(TTwKeyDownNotify far&)))(TTwKeyDownNotify far&)
  766. {
  767.   return pmf;
  768. }
  769.  
  770. template <class T>
  771. inline bool _CALLCNVN (T::*b_TV_DISPINFO_NOTIFY_Sig(bool _CALLCNVN (T::*pmf)(TTwDispInfoNotify far&)))(TTwDispInfoNotify far&)
  772. {
  773.   return pmf;
  774. }
  775.  
  776. template <class T>
  777. inline void _CALLCNVN (T::*v_TV_DISPINFO_NOTIFY_Sig(void _CALLCNVN (T::*pmf)(TTwDispInfoNotify far&)))(TTwDispInfoNotify far&)
  778. {
  779.   return pmf;
  780. }
  781.  
  782. //
  783. // Notification handled by parent with handler expecting TTwNotify&
  784. // as parameter.        i.e. void method(TTwNotify& nmHdr)
  785. //
  786. #define EV_TREEWIND_NOTIFY(id, notifyCode, method)\
  787.   {notifyCode, id, (TAnyDispatcher)::v_LPARAM_Dispatch,\
  788.   (TMyPMF)v_TREEWIND_NOTIFY_Sig(&TMyClass::method)}
  789.  
  790. //
  791. // Notification handled by parent with handler expecting TTwNotify& and
  792. // returning a bool.    i.e. bool method(TTwNotify& nmHdr)
  793. //
  794. #define EV_TREEWIND_NOTIFY_BOOL(id, notifyCode, method)\
  795.   {notifyCode, id, (TAnyDispatcher)::B_LPARAM_Dispatch,\
  796.   (TMyPMF)b_TREEWIND_NOTIFY_Sig(&TMyClass::method)}
  797.  
  798. //
  799. // Notification handled by parent with handler expecting TTwDispInfoNotify&
  800. // as parameter.        i.e. void method(TTwDispInfoNotify& nmHdr)
  801. //
  802. #define EV_TV_DISPINFO_NOTIFY(id, notifyCode, method)\
  803.   {notifyCode, id, (TAnyDispatcher)::v_LPARAM_Dispatch,\
  804.   (TMyPMF)v_TV_DISPINFO_NOTIFY_Sig(&TMyClass::method)}
  805.  
  806. //
  807. // Notification handled by parent with handler expecting TTwDispInfoNotify& and
  808. // returning a bool.    i.e. bool method(TTwDispInfoNotify& nmHdr)
  809. //
  810. #define EV_TV_DISPINFO_NOTIFY_BOOL(id, notifyCode, method)\
  811.   {notifyCode, id, (TAnyDispatcher)::B_LPARAM_Dispatch,\
  812.   (TMyPMF)b_TV_DISPINFO_NOTIFY_Sig(&TMyClass::method)}
  813.  
  814. #define EV_TVN_BEGINDRAG(id, method)      EV_TREEWIND_NOTIFY        (id, TVN_BEGINDRAG, method)
  815. #define EV_TVN_BEGINLABELEDIT(id, method) EV_TV_DISPINFO_NOTIFY_BOOL(id, TVN_BEGINLABELEDIT, method)
  816. #define EV_TVN_BEGINRDRAG(id, method)     EV_TREEWIND_NOTIFY        (id, TVN_BEGINRDRAG, method)
  817. #define EV_TVN_DELETEITEM(id, method)     EV_TREEWIND_NOTIFY        (id, TVN_DELETEITEM, method)
  818. #define EV_TVN_ENDLABELEDIT(id, method)   EV_TV_DISPINFO_NOTIFY     (id, TVN_ENDLABELEDIT, method)
  819. #define EV_TVN_GETDISPINFO(id, method)    EV_TV_DISPINFO_NOTIFY     (id, TVN_GETDISPINFO, method)
  820. #define EV_TVN_ITEMEXPANDED(id, method)   EV_TREEWIND_NOTIFY        (id, TVN_ITEMEXPANDED, method)
  821. #define EV_TVN_ITEMEXPANDING(id, method)  EV_TREEWIND_NOTIFY_BOOL   (id, TVN_ITEMEXPANDING, method)
  822. #define EV_TVN_SELCHANGED(id, method)     EV_TREEWIND_NOTIFY        (id, TVN_SELCHANGED, method)
  823. #define EV_TVN_SELCHANGING(id, method)    EV_TREEWIND_NOTIFY_BOOL   (id, TVN_SELCHANGING, method)
  824. #define EV_TVN_SETDISPINFO(id, method)    EV_TV_DISPINFO_NOTIFY     (id, TVN_SETDISPINFO, method)
  825. #define EV_TVN_KEYDOWN(id, method)\
  826.   {TVN_KEYDOWN, id, (TAnyDispatcher)::v_LPARAM_Dispatch,\
  827.   (TMyPMF)v_TV_KEYDOWN_NOTIFY_Sig(&TMyClass::method)}
  828.  
  829. //----------------------------------------------------------------------------
  830. // ListWindow control notifications
  831. //
  832. template <class T>
  833. inline void (T::*v_LISTWIND_NOTIFY_Sig(void (T::*pmf)(TLwNotify far&)))(TLwNotify far&)
  834. {
  835.   return pmf;
  836. }
  837.  
  838. template <class T>
  839. inline bool (T::*b_LISTWIND_NOTIFY_Sig(bool (T::*pmf)(TLwNotify far&)))(TLwNotify far&)
  840. {
  841.   return pmf;
  842. }
  843.  
  844. template <class T>
  845. inline void (T::*v_LV_KEYDOWN_NOTIFY_Sig(void (T::*pmf)(TLwKeyDownNotify far&)))(TLwKeyDownNotify far&)
  846. {
  847.   return pmf;
  848. }
  849.  
  850. template <class T>
  851. inline bool (T::*b_LV_DISPINFO_NOTIFY_Sig(bool (T::*pmf)(TLwDispInfoNotify far&)))(TLwDispInfoNotify far&)
  852. {
  853.   return pmf;
  854. }
  855.  
  856. template <class T>
  857. inline void (T::*v_LV_DISPINFO_NOTIFY_Sig(void (T::*pmf)(TLwDispInfoNotify far&)))(TLwDispInfoNotify far&)
  858. {
  859.   return pmf;
  860. }
  861.  
  862. //
  863. // Notification handled by parent with handler expecting TLwNotify&
  864. // as parameter.        i.e. void method(TLwNotify& nmHdr)
  865. //
  866. #define EV_LISTWIND_NOTIFY(id, notifyCode, method)\
  867.   {notifyCode, id, (TAnyDispatcher)::v_LPARAM_Dispatch,\
  868.   (TMyPMF)v_LISTWIND_NOTIFY_Sig(&TMyClass::method)}
  869.  
  870. //
  871. // Notification handled by parent with handler expecting TLwNotify& and
  872. // returning a bool.
  873. //                      i.e. bool method(TLwNotify& nmHdr)
  874. //
  875. #define EV_LISTWIND_NOTIFY_BOOL(id, notifyCode, method)\
  876.   {notifyCode, id, (TAnyDispatcher)::B_LPARAM_Dispatch,\
  877.   (TMyPMF)b_LISTWIND_NOTIFY_Sig(&TMyClass::method)}
  878.  
  879. //
  880. // Notification handled by parent with handler expecting TLwDispInfoNotify&
  881. // as parameter.        i.e. void method(TLwDispInfoNotify& nmHdr)
  882. //
  883. #define EV_LV_DISPINFO_NOTIFY(id, notifyCode, method)\
  884.   {notifyCode, id, (TAnyDispatcher)::v_LPARAM_Dispatch,\
  885.   (TMyPMF)v_LV_DISPINFO_NOTIFY_Sig(&TMyClass::method)}
  886.  
  887. //
  888. // Notification handled by parent with handler expecting TLwDispInfoNotify& and
  889. // returning a bool.
  890. //                      i.e. bool method(TLwDispInfoNotify& nmHdr)
  891. //
  892. #define EV_LV_DISPINFO_NOTIFY_BOOL(id, notifyCode, method)\
  893.   {notifyCode, id, (TAnyDispatcher)::B_LPARAM_Dispatch,\
  894.   (TMyPMF)b_LV_DISPINFO_NOTIFY_Sig(&TMyClass::method)}
  895.  
  896. #define EV_LVN_KEYDOWN(id, method)\
  897.   {LVN_KEYDOWN, id, (TAnyDispatcher)::v_LPARAM_Dispatch,\
  898.   (TMyPMF)v_LV_KEYDOWN_NOTIFY_Sig(&TMyClass::method)}
  899.  
  900. #define EV_LVN_BEGINDRAG(id, method)        EV_LISTWIND_NOTIFY(id, LVN_BEGINDRAG, method)
  901. #define EV_LVN_BEGINLABELEDIT(id, method)   EV_LV_DISPINFO_NOTIFY_BOOL(id, LVN_BEGINLABELEDIT, method)
  902. #define EV_LVN_BEGINRDRAG(id, method)       EV_LISTWIND_NOTIFY(id, LVN_BEGINRDRAG, method)
  903. #define EV_LVN_COLUMNCLICK(id, method)      EV_LISTWIND_NOTIFY(id, LVN_COLUMNCLICK, method)
  904. #define EV_LVN_DELETEALLITEMS(id, method)   EV_LISTWIND_NOTIFY(id, LVN_DELETEALLITEMS, method)
  905. #define EV_LVN_DELETEITEM(id, method)       EV_LISTWIND_NOTIFY(id, LVN_DELETEITEM, method)
  906.  
  907. #if 0   // LVN_ENDDRAG is documented but not defined (currently)
  908. #define EV_LVN_ENDDRAG(id, method)          EV_LISTWIND_NOTIFY(id, LVN_ENDDRAG, method)
  909. #endif
  910.  
  911. #if 0   // LVN_ENDRDRAG is documented but not defined (currently)
  912. #define EV_LVN_ENDRDRAG(id, method)         EV_LISTWIND_NOTIFY(id, LVN_ENDRDRAG, method)
  913. #endif
  914.  
  915. #define EV_LVN_ENDLABELEDIT(id, method)     EV_LV_DISPINFO_NOTIFY(id, LVN_ENDLABELEDIT, method)
  916. #define EV_LVN_GETDISPINFO(id, method)      EV_LV_DISPINFO_NOTIFY(id, LVN_GETDISPINFO, method)
  917. #define EV_LVN_INSERTITEM(id, method)       EV_LISTWIND_NOTIFY(id, LVN_INSERTITEM, method)
  918. #define EV_LVN_ITEMCHANGED(id, method)      EV_LISTWIND_NOTIFY(id, LVN_ITEMCHANGED, method)
  919. #define EV_LVN_ITEMCHANGING(id, method)     EV_LISTWIND_NOTIFY_BOOL(id, LVN_ITEMCHANGING, method)
  920. #define EV_LVN_SETDISPINFO(id, method)      EV_LV_DISPINFO_NOTIFY(id, LVN_SETDISPINFO, method)
  921.  
  922. #if defined(BI_NAMESPACE)
  923. } // namespace OWL
  924. #endif
  925.  
  926. //----------------------------------------------------------------------------
  927. // Inline implemenations
  928. //
  929.  
  930. //
  931. // Constructor to create a TNotify object [NMHDR wrapper] from the specified
  932. // window handle, control id and notification code.
  933. //
  934. inline
  935. TNotify::TNotify(HWND ctl, uint id, uint ctlCode) {
  936.   hwndFrom = ctl;
  937.   idFrom = id;
  938.   code = ctlCode;
  939. }
  940.  
  941. //
  942. // Constructor to create a TNotify object whose members are initialized to
  943. // zero.
  944. //
  945. inline
  946. TNotify::TNotify() {
  947.   hwndFrom = 0;
  948.   idFrom = 0;
  949.   code = 0;
  950. }
  951.  
  952. //
  953. // TTabKeyDown contains information about a key press in a tab control.
  954. // This constructor initializes the structure NUL value for the
  955. // virtual wVKey and flags members.
  956. //
  957. inline
  958. TTabKeyDown::TTabKeyDown() {
  959.   wVKey = 0;
  960.   flags = 0;
  961. }
  962.  
  963. //
  964. // TTabKeyDown contains information about a key press in a tab control.
  965. // This constructor initializes the members to the specified parameters.
  966. //
  967. inline TTabKeyDown::TTabKeyDown(HWND ctl, uint id, uint code, uint16 vk, uint flg)
  968. {
  969.   hdr.hwndFrom = ctl;
  970.   hdr.idFrom = id;
  971.   hdr.code = code;
  972.   wVKey = vk;
  973.   flags = flg;
  974. }
  975.  
  976.  
  977. #endif  // OWL_COMMCTRL_H
  978.  
  979.